<?php 
$articleValue = new Models_Articles();
if($_SESSION['action'] == 'showsub')
{
    $articleId = $articleValue->getArticleId($_SESSION['article']);
} elseif($_SESSION['action'] == 'show') {
    $articleId[$articleValue->lang . '_article_id'] = $_SESSION['article'];
}
if($_SESSION['article'] == NULL)
{
    $active = 'class="active"';
    $articleId = 0;
} else {
    $active = '';
}
if(!isset($articleId))
{
    $articleId[$articleValue->lang . '_article_id'] = 0;
}
?>
<div class="well" style="padding: 8px 0;">
    <ul class="nav nav-list">
        <li <?php echo $active; ?>><a href="/">Main</a></li>
<?php
$content = new Models_Menu();
$menu = $content->getMenu();
foreach($menu as $value)
{
    echo '<li class="nav-header">';
    echo $value['name'];
    echo '</li>';
    $subMenu = $content->getSubMenu($value['id']);
    
    foreach ($subMenu as $subValue)
    {
        if($articleId[$content->lang . '_article_id'] == $subValue[$content->lang . '_article_id'])
        {
            $active = 'class="active"';
        } else {
            $active = '';
        }
        echo '<li ' . $active .  '><a href="/' 
                . $content->path . 'articles/show/' 
                . $subValue[$content->lang . '_article_id'] . '">';
        echo $subValue['name'];
        echo '</a></li>';
    }
}
?>
    </ul>
</div>